import os

from selenium.webdriver.common.by import By

from base.Base import Base

class Page_baidu(Base):
    baidu_url=os.getenv('base_url')
    #为设置进行定位  id="s-usersetting-top"
    setting_loc=(By.ID,'s-usersetting-top')
    #搜索设置
    search_setting_loc=(By.CLASS_NAME,'set')
    #保存设置
    sava_setting_loc=(By.XPATH,'//*[@id="se-setting-7"]/a[2]')
    #封装设置方法

    # 点击设置进行鼠标悬停
    def move_to_setting(self):
        self.click(self.setting_loc)

    #点击搜索设置
    def search(self):
        self.click(self.search_setting_loc)
    #点击保存
    def sava_setting(self):
        self.click(self.sava_setting_loc)

    def baodu_luoji(self):
        self.open_url(self.baidu_url)
        self.move_to_setting()
        self.search()
        self.sava_setting()

